﻿<UserControls:ScrumUserControl x:Class="ScrumTable.UI.View.WinTouch.UserControls.View.ProjectSetting"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008" xmlns:Converter="clr-namespace:ScrumTable.UI.View.Converter;assembly=ScrumTable.UI.View"
    xmlns:Localization="clr-namespace:ScrumTable.UI.View.Localization;assembly=ScrumTable.UI.View" xmlns:UserControls="clr-namespace:ScrumTable.UI.View.WinTouch.UserControls" xmlns:CustomControl="clr-namespace:ScrumTable.UI.View.WinTouch.CustomControl" Background="{StaticResource ScreenConfiguration}" x:Name="Root" MinWidth="1000">
    <CustomControl:ScrumTableScrollViewer  Margin="75,20,75,0" HorizontalAlignment="Stretch" VerticalAlignment="Top" x:Name="ScrollViewer">
        <Grid HorizontalAlignment="Stretch" Margin="0,0,0,0"  MaxWidth="{Binding ElementName=ScrollViewer, Path=ActualWidth}"  >
            <Grid HorizontalAlignment="Stretch">
                <Grid.Resources>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="GrayBrush">
                        <GradientStop Color="#FFF2F2F2"/>
                        <GradientStop Color="White" Offset="1"/>
                        <GradientStop Color="#FFE6E5E5" Offset="0.468"/>
                    </LinearGradientBrush>

                    <Style TargetType="{x:Type s:SurfaceButton}" BasedOn="{StaticResource SurfaceButtonStyle}" />


                    <Style TargetType="{x:Type Label}" BasedOn="{StaticResource DescriptionLabel}"/>
                    
                    <Converter:ConverterIsNullVisibility x:Key="ConverterIsNullBoolVisibility" />
                    <Converter:ConverterNotBoolVisibility x:Key="ConverterNotBoolVisibility"/>
                    <DataTemplate x:Key="listTemplate">
                        <Grid VerticalAlignment="Stretch" MaxWidth="170" Width="170" Margin="5,20,5,20">
                            <Border BorderBrush="#49FFFFFF" BorderThickness="2,2,0,0"  CornerRadius="5"/>
                            <Border BorderBrush="#49000000" BorderThickness="0,0,2,2"  CornerRadius="5"/>

                            <Border CornerRadius="5" Margin="2" Background="{StaticResource GrayBrush}">

                                <StackPanel HorizontalAlignment="Stretch"  Margin="5" >
                                    <TextBlock Text="{Binding Name}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </StackPanel>
                            </Border>
                        </Grid>
                    </DataTemplate>
                </Grid.Resources>
                <Grid.RowDefinitions>
                    <RowDefinition Height="0"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="0.05*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="400" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="50" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MaxWidth="0" />
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>         
                </Grid.ColumnDefinitions>
                

                <Label Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left">
                    <Label.Content>
                        <Localization:Translate Uid="ProjectSettings_Sprint" Default="[Sprint]" />
                    </Label.Content>
                </Label>

                <UserControls:SurfaceDragDropListBox 
            x:Name="ListIteration" ScrollViewer.HorizontalScrollBarVisibility="Auto"
            MultipleColumnsRows="False"
            CanDrag="False"
            Opacity="0.75"            
            AllowDrop="False"                     
            ItemsSource="{Binding Path=ScrumData.CurrentProject.Iterations}"
            ItemsAreStatic="True"
            Orientation="Horizontal"
            SelectedItem="{Binding Path=CurrentIteration, Mode=TwoWay}"   
            Margin="0,0,0,0" VerticalContentAlignment="Center"
            Grid.ColumnSpan="3" Grid.Column="1" Grid.Row="3" ItemTemplate="{StaticResource listTemplate}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel IsItemsHost="True" Orientation="Horizontal" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </UserControls:SurfaceDragDropListBox>


                <Grid Grid.ColumnSpan="2" Grid.Column="1" Margin="0,20,0,0" Grid.Row="4" Visibility="{Binding Path=CurrentIteration, Converter={StaticResource ConverterIsNullBoolVisibility}}">
                    <Grid.ColumnDefinitions>                        
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>                     
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="400" />
                    </Grid.RowDefinitions>

                    <Label Grid.Column="0" Grid.Row="0" Opacity="0.8" HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False">
                        <Label.Content>
                            <Localization:Translate Uid="ProjectSettings_StartDate" Default="[Sprint Start Date]" />
                        </Label.Content>
                    </Label>
                    <Grid  Width="400" Height="400" Grid.Row="1" Grid.Column="0">
                        <Calendar Name="CalenderFrom" HorizontalAlignment="Left" VerticalAlignment="Top"  SelectedDate="{Binding CurrentIteration.StartTime}" DisplayDate="{Binding CurrentIteration.StartTime}" SelectionMode="SingleDate"  Background="Transparent" IsTodayHighlighted="False"  UseLayoutRounding="True">
                            <Calendar.RenderTransform>
                                <ScaleTransform ScaleX="2" ScaleY="2" CenterX="0" CenterY="0"/>
                            </Calendar.RenderTransform>
                        </Calendar>
                    </Grid>
                    <Label Grid.Row="0"  Grid.Column="1" Opacity="0.8" HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False">
                        <Label.Content>
                            <Localization:Translate Uid="ProjectSettings_EndDate" Default="[Sprint End Date]" />
                        </Label.Content>
                    </Label>
                    <Grid Width="400" Height="400" Grid.Row="1" Grid.Column="1">
                        <Calendar HorizontalAlignment="Left" VerticalAlignment="Top" SelectedDate="{Binding CurrentIteration.EndTime}"   IsTodayHighlighted="False"  UseLayoutRounding="True" DisplayDate="{Binding CurrentIteration.EndTime}" SelectionMode="SingleDate"  Background="Transparent" >
                            <Calendar.RenderTransform>
                                <ScaleTransform ScaleX="2" ScaleY="2" CenterX="0" CenterY="0"/>
                            </Calendar.RenderTransform>
                        </Calendar>
                    </Grid>
                </Grid>
                <s:SurfaceButton Visibility="{Binding InWizardMode, Converter={StaticResource ResourceKey=ConverterBoolToVisibility}}"   FontSize="14" FontWeight="Bold" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="5" Name="Next" Click="OnNextClick" HorizontalAlignment="Left" VerticalAlignment="Top"  Width="200" Height="40" Margin="0,20,0,0" Style="{StaticResource SurfaceButtonStyle}">
                    <s:SurfaceButton.Content>
                        <Localization:Translate Uid="ProjectSettings_ButtonNext" Default="[Next]" />
                    </s:SurfaceButton.Content>
                </s:SurfaceButton>

                <Label Foreground="Red" Visibility="{Binding Path=HasRights, Converter={StaticResource ConverterNotBoolVisibility}}" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="6">
                    <Label.Content>
                        <Localization:Translate Uid="Error_Services" Default="[No access to the Sharepoint/Reporting services!]" />
                    </Label.Content>
                </Label>

            </Grid>

        </Grid>
    </CustomControl:ScrumTableScrollViewer>
</UserControls:ScrumUserControl>
